main :	 					globais.o globaisCG.o main.o inversao.o simulacao.o entrada.o entradainversao.o loadSismog.o calcErro.o calcMisfitFinal.o mapCemX.o mapXemC.o dcdxfc.o criadepCX.o modelo_2d.o interpola.o modelo_2d_camadas.o modelo_2d_camadasX3.o PDMDFDF1.o PDMDFDT1.o numclassesF.o numclassesIm.o clusteriza.o clusterizainterat.o suaviza.o regularizaTV.o regularizaL2.o rickerwavelet.o invdft.o dft.o systempsimage.o systempsmovie.o systempsmovieSOL.o systempswigp.o refinagrid.o cg_napack.o fcn.o lb1.o lb2.o daxpy.o ddot.o mcsrch.o mcstep.o lbfgs.o L-BFGS-modif.o LAMBDA-L-BFGS.o lm-LAMBDA-L-BFGS.o c_fortran_zgssv.o c_fortran_dgssv.o
	gfortran -fbounds-check    -o main	globais.o globaisCG.o main.o inversao.o simulacao.o entrada.o entradainversao.o loadSismog.o calcErro.o calcMisfitFinal.o mapCemX.o mapXemC.o dcdxfc.o criadepCX.o modelo_2d.o interpola.o modelo_2d_camadas.o modelo_2d_camadasX3.o PDMDFDF1.o PDMDFDT1.o numclassesF.o numclassesIm.o clusteriza.o clusterizainterat.o suaviza.o regularizaTV.o regularizaL2.o rickerwavelet.o invdft.o dft.o systempsimage.o systempsmovie.o systempsmovieSOL.o systempswigp.o refinagrid.o cg_napack.o fcn.o lb1.o lb2.o daxpy.o ddot.o mcsrch.o mcstep.o lbfgs.o L-BFGS-modif.o LAMBDA-L-BFGS.o lm-LAMBDA-L-BFGS.o c_fortran_zgssv.o c_fortran_dgssv.o  /usr/lib/libsuperlu.so.3   /usr/lib/libblas.so  -lm  

# /usr/lib/libminpack.so.1
# /usr/lib/lapack/liblapack.so.3gf 
# c_fortran_zgssv.o   /usr/lib/libsuperlu.so.3



globaisCG.o : globaisCG.f90
	gfortran -fbounds-check    -c globaisCG.f90

globais.o : globais.f90
	gfortran -fbounds-check    -c globais.f90

main.o : main.f90 
	gfortran -fbounds-check    -c main.f90

entrada.o : entrada.f90 globais.f90 
	gfortran -fbounds-check    -c entrada.f90

inversao.o : inversao.f90 globais.f90 
	gfortran -fbounds-check    -c inversao.f90

simulacao.o : simulacao.f90 globais.f90 
	gfortran -fbounds-check    -c simulacao.f90

entradainversao.o : entradainversao.f90 globais.f90 
	gfortran -fbounds-check    -c entradainversao.f90

loadSismog.o :: loadSismog.f90
	gfortran -fbounds-check    -c loadSismog.f90

calcErro.o : calcErro.f90 
	gfortran -fbounds-check    -c calcErro.f90

calcMisfitFinal.o :: calcMisfitFinal.f90
	gfortran -fbounds-check    -c calcMisfitFinal.f90

mapXemC.o : mapXemC.f90
	gfortran -fbounds-check    -c mapXemC.f90

mapCemX.o : mapCemX.f90
	gfortran -fbounds-check    -c mapCemX.f90

dcdxfc.o : dcdxfc.f90
	gfortran -fbounds-check    -c dcdxfc.f90

criadepCX.o : criadepCX.f90  globais.f90
	gfortran -fbounds-check    -c criadepCX.f90

modelo_2d.o : modelo_2d.f90 interpola.f90 globais.f90
	gfortran -fbounds-check    -c modelo_2d.f90

interpola.o : interpola.f90 
	gfortran -fbounds-check    -c interpola.f90

modelo_2d_hustedt.o : modelo_2d_hustedt.f90 systempsimage.f90 globais.f90
	gfortran -fbounds-check    -c modelo_2d_hustedt.f90

modelo_2d_homog.o : modelo_2d_homog.f90 systempsimage.f90 globais.f90
	gfortran -fbounds-check    -c modelo_2d_homog.f90

modelo_2d_camadas.o : modelo_2d_camadas.f90 systempsimage.f90 globais.f90
	gfortran -fbounds-check    -c modelo_2d_camadas.f90

modelo_2d_camadasX3.o : modelo_2d_camadasX3.f90 systempsimage.f90 globais.f90
	gfortran -fbounds-check    -c modelo_2d_camadasX3.f90

# modelo_2d_camadas_viscoacoustico.o : modelo_2d_camadas_viscoacoustico.f90 systempsimage.f90 globais.f90
# 	gfortran -fbounds-check    -c modelo_2d_camadas_viscoacoustico.f90

PDMDFDF1.o : PDMDFDF1.f90 globais.f90
	gfortran -fbounds-check    -c PDMDFDF1.f90

PDMDFDT1.o : PDMDFDT1.f90 
	gfortran -fbounds-check    -c PDMDFDT1.f90

c_fortran_zgssv.o: c_fortran_zgssv.c
	gcc -fbounds-check -I /usr/include/superlu -c  c_fortran_zgssv.c

c_fortran_dgssv.o: c_fortran_dgssv.c
	gcc -fbounds-check -I /usr/include/superlu -c  c_fortran_dgssv.c

# pd_2d_LiaoMcMechan.o : pd_2d_LiaoMcMechan.f90 globais.f90
# 	gfortran -fbounds-check    -c pd_2d_LiaoMcMechan.f90

numclassesF.o : numclassesF.f90
	gfortran -fbounds-check    -c numclassesF.f90

numclassesIm.o : numclassesIm.f90
	gfortran -fbounds-check    -c numclassesIm.f90

clusteriza.o : clusteriza.f90
	gfortran -fbounds-check    -c clusteriza.f90

clusterizainterat.o : clusterizainterat.f90
	gfortran -fbounds-check    -c clusterizainterat.f90

suaviza.o : suaviza.f90
	gfortran -fbounds-check    -c suaviza.f90

regularizaTV.o : regularizaTV.f90   globais.f90
	gfortran -fbounds-check    -c regularizaTV.f90

regularizaL2.o : regularizaL2.f90   globais.f90
	gfortran -fbounds-check    -c regularizaL2.f90

# regularizaWL2.o : regularizaWL2.f90   globais.f90
# 	gfortran -fbounds-check    -c regularizaWL2.f90
# 
# regularizaL2.o : regularizaL2.f90   globais.f90
# 	gfortran -fbounds-check    -c regularizaL2.f90
# 
# regularizaTikho.o : regularizaTikho.f90   globais.f90
# 	gfortran -fbounds-check    -c regularizaTikho.f90

rickerwavelet.o : rickerwavelet.f90
	gfortran -fbounds-check    -c rickerwavelet.f90

# fonte.o : fonte.f90 globais.f90
# 	gfortran -fbounds-check    -c fonte.f90
dft.o : dft.f90
	gfortran -fbounds-check    -c dft.f90	

invdft.o : invdft.f90
	gfortran -fbounds-check    -c invdft.f90	

refinagrid.o : refinagrid.f90  globais.f90
	gfortran -fbounds-check    -c refinagrid.f90

# saidas graficas
systempsimage.o : systempsimage.f90
	gfortran -fbounds-check    -c systempsimage.f90

systempsmovie.o : systempsmovie.f90
	gfortran -fbounds-check    -c systempsmovie.f90

systempsmovieSOL.o : systempsmovieSOL.f90
	gfortran -fbounds-check    -c systempsmovieSOL.f90

systempswigp.o : systempswigp.f90
	gfortran -fbounds-check    -c systempswigp.f90


# inversao
# fcnLM.o : fcnLM.f90  globais.f90
# 	gfortran -fbounds-check    -c fcnLM.f90
# 
# 
# routinesLBFGS.o : routinesLBFGS.f90
# 	gfortran -fbounds-check    -c routinesLBFGS.f90
# 
# # # #Minpack
# # # dpmpar.o : dpmpar.f90 
# # # 	gfortran -fbounds-check   -c dpmpar.f90
# # # 
# # # enorm.o : enorm.f90 
# # # 	gfortran -fbounds-check   -c enorm.f90
# # # 
# # # fdjac2.o : fdjac2.f90 
# # # 	gfortran -fbounds-check   -c fdjac2.f90
# # # 
# # # lmdif.o : lmdif.f90 
# # # 	gfortran -fbounds-check   -c lmdif.f90
# # # 
# # # lmpar.o : lmpar.f90 
# # # 	gfortran -fbounds-check   -c lmpar.f90
# # # 
# # # qrfac.o : qrfac.f90 
# # # 	gfortran -fbounds-check   -c qrfac.f90
# # # 
# # # qrsolv.o : qrsolv.f90 
# # # 	gfortran -fbounds-check   -c qrsolv.f90

# conjugate gradient methods do Napack, baixado da netlib
cg_napack.o : cg_napack.f 
	gfortran -fbounds-check   -c cg_napack.f

fcn.o : fcn.f90 
	gfortran -fbounds-check   -c fcn.f90

# L-BFGS, Nocedal, http://users.eecs.northwestern.edu/~nocedal/lbfgs.html
# Rotinas usadas pelo L-BFGS
lb1.o : lb1.f
	gfortran  -c lb1.f	

lb2.o : lb2.f
	gfortran  -c lb2.f

daxpy.o : daxpy.f
	gfortran  -c daxpy.f

ddot.o : ddot.f
	gfortran  -c ddot.f	

mcsrch.o : mcsrch.f
	gfortran  -c mcsrch.f

mcstep.o : mcstep.f
	gfortran  -c mcstep.f


# versoes do LBFGS
lbfgs.o : lbfgs.f
	gfortran  -c lbfgs.f	

L-BFGS-modif.o : L-BFGS-modif.f
	gfortran  -fbounds-check -c L-BFGS-modif.f	

LAMBDA-L-BFGS.o : LAMBDA-L-BFGS.f
	gfortran  -fbounds-check -c LAMBDA-L-BFGS.f	

lm-LAMBDA-L-BFGS.o : lm-LAMBDA-L-BFGS.f
	gfortran  -fbounds-check -c lm-LAMBDA-L-BFGS.f		

# LAMBDA-L-BFGS.o : LAMBDA-L-BFGS.f
# 	gfortran  -fbounds-check -c LAMBDA-L-BFGS.f		

# conjugate gradient methods
# Gilbert, J.C. and Nocedal, J. (1992). "Global Convergence Properties 
#        of Conjugate Gradient Methods", SIAM Journal on Optimization, Vol. 2,
#        pp. 21-42.
# 
# blas.o : blas.f90 
# 	gfortran -fbounds-check   -c blas.f90
# 
# cgfam.o : cgfam.f90 
# 	gfortran -fbounds-check   -c cgfam.f90
# 
# cgsearch.o : cgsearch.f90 
# 	gfortran -fbounds-check   -c cgsearch.f90
# 
# fcnCG.o : fcnCG.f90 
# 	gfortran -fbounds-check    -c fcnCG.f90
# 
# timer.o : timer.f90 
# 	gfortran -fbounds-check   -c timer.f90

clean:	
	rm -f *.o *~ main



#  +ffree+form por +nofixed trocando + por -, claro!